<template>
	<div v-show="isShow">
		<h1>{{title}}</h1>
		<el-table :data="list">
			<el-table-column prop="name"></el-table-column>
			<!-- <el-table-column prop="age"></el-table-column> -->
		</el-table>
		<el-button type="warning" @click='ret' > 返回 </el-button>
		<el-button @click="read">读取json</el-button>
	</div>
</template>

<script>
	// import Vue from "Vue";
	// import element from "element-ui";
	// Vue.use(element);
	export default {
		name:"home",
		props:["title","list","visiable"],
		data:function(){
			return {
				userlist:[],
			}
		},
		computed:{
			isShow:function( ){
				return this.visiable;
			}
		},
		methods:{
			hi:function(){
				var o = _.extend({},{msg:"hihihi"});
				alert(o.msg);
			},
			ret : function(){
				//vue2.3.0之后，增加了sync的修饰，被sync修饰后的prop，实际上是使用update事件来触发父组的更新
				//实际上是一个语法糖，详情查阅官网说明
				this.$emit('update:visiable', false);
			},
			read:function() {
				this.$http.get("/common/enum/device_powered.json")
				.then( r => console.log(r) );
			}
		}
	}
</script>
